package com.heima.wemedia.feign;

import com.heima.apis.wemedia.IWemediaClient;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.pojos.ApUserRealname;
import com.heima.model.wemedia.pojos.WmSensitive;
import com.heima.wemedia.service.SenSitiveService;
import com.heima.wemedia.service.WmUserService;
import com.heima.wemedia.service.WmchannelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class WemediaClient implements IWemediaClient {

    @Autowired
    private WmUserService wmUserService;
    @Autowired
    private WmchannelService wmchannelService;
    @Autowired
    private SenSitiveService senSitiveService;

    @PostMapping("/api/v1/pass")
    @Override
    public void authPass(@RequestBody ApUserRealname realname) {
        wmUserService.authPass(realname);
    }

    @GetMapping("/api/v1/channel/list")
    public ResponseResult getHotChannels() {
        return wmchannelService.getChannels();
    }

    @Override
    @GetMapping("/api/v1/list")
    public List<WmSensitive> selectList() {
        return senSitiveService.selectList();
    }
}
